/** 
 * Description:
 * Date:2012-5-1
 * Author:Along	
*/
package com.community.shopping.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.community.shopping.util.RequestHelp;

public class RoleFilter implements Filter {

	public void destroy() {
		// TODO Auto-generated method stub
		
	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain filterchain) throws IOException, ServletException {		
		  HttpServletRequest req=(HttpServletRequest)request;         
		  HttpServletResponse res=(HttpServletResponse)response; 
		if(req.getSession().getAttribute(RequestHelp.SESSION_SHOPID)==null)
		{	
			res.sendRedirect("../login.jsp");
		}
		else
		{
		 filterchain.doFilter(request, response);  
		}
		
	}

	public void init(FilterConfig arg0) throws ServletException {
		// TODO Auto-generated method stub
		
	}

}
